This fixes the "make check" feature of xenstore to properly compile with
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 22 Sep 2005 10:04:30 +0000 (11:04 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 22 Sep 2005 10:04:30 +0000 (11:04 +0100)
x86-64. When compiling you would get the following error since on x86-64
it was passing a long , when you are expecting an int.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
tools/xenstore/xs_random.c

index 04a0411396d655ff73018d16923471aef16360b9..ebda938e379c4bb24c70b6e061ac3b86abd0987a 100644 (file)
@@ -74,9 +74,9 @@ static void convert_to_dir(const char *dirname)
 static void maybe_convert_to_directory(const char *filename)
 {
        struct stat st;
-       char *dirname = talloc_asprintf(filename, "%.*s", 
-                                       strrchr(filename, '/') - filename,
-                                       filename);
+       char *dirname = talloc_asprintf(
+               filename, "%.*s",
+               (int)(strrchr(filename, '/') - filename), filename);
        if (lstat(dirname, &st) == 0 && S_ISREG(st.st_mode))
                convert_to_dir(dirname);
 }
@@ -249,7 +249,7 @@ static void init_perms(const char *filename)
 
        /* Copy permissions from parent */
        command = talloc_asprintf(filename, "cp %.*s/.perms %s",
-                                 strrchr(filename, '/') - filename,
+                                 (int)(strrchr(filename, '/') - filename),
                                  filename, permfile);
        do_command(command);
 }      
@@ -308,7 +308,7 @@ static char *parent_filename(const char *name)
        char *slash = strrchr(name + 1, '/');
        if (!slash)
                return talloc_strdup(name, "/");
-       return talloc_asprintf(name, "%.*s", slash-name, name);
+       return talloc_asprintf(name, "%.*s", (int)(slash-name), name);
 }
 
 static void make_dirs(const char *filename)
@@ -1063,7 +1063,8 @@ static unsigned int try_simple(const bool *trymap,
 
                ret = do_next_op(data->ops, h, i + data->seed, verbose);
                if (verbose)
-                       printf("-> %.*s\n", strchr(ret, '\n') - ret, ret);
+                       printf("-> %.*s\n",
+                              (int)(strchr(ret, '\n') - ret), ret);
                if (streq(ret, "FAILED:Bad file descriptor"))
                        goto out;
                if (kill(daemon_pid, 0) != 0)
@@ -1334,13 +1335,14 @@ static unsigned int try_diff(const bool *trymap,
 
                file = do_next_op(&file_ops, fileh, i+data->seed, verbose);
                if (verbose)
-                       printf("-> %.*s\n", strchr(file, '/') - file, file);
+                       printf("-> %.*s\n",
+                              (int)(strchr(file, '/') - file), file);
                
                if (verbose)
                        printf("XS: ");
                xs = do_next_op(&xs_ops, xsh, i+data->seed, verbose);
                if (verbose)
-                       printf("-> %.*s\n", strchr(xs, '/') - xs, xs);
+                       printf("-> %.*s\n", (int)(strchr(xs, '/') - xs), xs);
 
                if (!streq(file, xs))
                        goto out;
@@ -1508,7 +1510,8 @@ static unsigned int try_fail(const bool *trymap,
                        aborted++;
 
                if (verbose)
-                       printf("-> %.*s\n", strchr(ret, '\n') - ret, ret);
+                       printf("-> %.*s\n",
+                              (int)(strchr(ret, '\n') - ret), ret);
 
                talloc_free(ret);